<?php
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
if($_RQ['op']=='list'){
	$id = intval($_RQ['id']);
	if($id) {
		$return['item']=pdo_get('jy_peiedu_gonggao',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
	}else{
		$return['item']=pdo_get('jy_peiedu_gonggao',array('uniacid'=>$_SESSION['uniacid'],'status'=>1),'','paixu desc');
	}
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
	if($_RQ['title']){
		$params['title like']='%'.trim($_RQ['title']).'%';
		$return['params']['title']=$_RQ['title'];
	}
	$orderby=array();
	$pindex = max(1, intval($_RQ['page']));
	if($_RQ['num']){
		$psize = $_RQ['num'];
	}else{
		$psize = 10;
	}
	$total='';
	$list=pdo_getslice('jy_peiedu_gonggao',$params,array($pindex,$psize),$total,$fields,'','paixu desc,id desc');
	if($list){
		foreach($list as &$item){
			$item['content'] = strip_tags(str_replace('&nbsp;','',$item['content']));
			$item['desc'] = $item['desc'] ? $item['desc'] : cfc('tools')->substr($item['content'],0,98);
			$item['createtime']=date('y/m/d H:i:s',$item['createtime']);
		}
	}
	$return['list']=$list?$list:array();
	set_html('title','通知公告');
	exi($return);
}
